#!/bin/sh
mkdir -p logs/
NGX=/opt/openresty/nginx/sbin/nginx 

conf_test() {
	${NGX} -p . -t
}

start() {
	${NGX} -p .
}

reload() {
	${NGX} -p . -s reload
}

stop() {
	${NGX} -p . -s stop
}

case "$1" in
start)
	conf_test || exit 0
	$1;;
stop)
	$1;;
test)
	conf_test || exit 0;;
reload)
	conf_test || exit 0
	$1;;
*)
	echo "Usage: ${0} [start|stop|reload|test]";;
esac
